package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.db.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("select count( distinct user_id) as num from tb_log  where log_time=#{todayStr} and type=#{type}")
    Integer queryNumLoginOrRegistry(@Param("todayStr") String todayStr,@Param("type")String type);

    @Select("select count( distinct user_id) as num from tb_log  where log_time=#{todayStr}")
    Integer queryNumActive(String todayStr);

    @Select("select   count(distinct user_id)  as num from tb_log  where log_time=#{todayStr} and user_id in " +
            "            (select   distinct user_id  as num from tb_log  where log_time=#{yesTodayStr} and type='0102')")
    Integer queryNumRetention1d(@Param("todayStr")String todayStr, @Param("yesTodayStr")String yesTodayStr);
}
